import { ApiProperty } from '@nestjs/swagger';
import { IsEmail, IsNotEmpty, Length } from 'class-validator';

export class CreateUserDto {
  @IsNotEmpty({
    message: '用户名不能为空',
  })
  @Length(4, 10, {
    message: '用户名长度必须在4-10个字符之间',
  })
  @ApiProperty()
  username: string;

  @IsNotEmpty({
    message: '密码不能为空',
  })
  @Length(6, 18, {
    message: '密码长度必须在6-18个字符之间',
  })
  @ApiProperty()
  password: string;

  @IsNotEmpty({
    message: '邮箱不能为空',
  })
  @IsEmail(
    {},
    {
      message: '请输入正确的邮箱格式',
    },
  )
  @ApiProperty()
  email: string;

  // @ApiProperty({ description: '验证码' })
  // @IsNotEmpty({ message: '验证码不能为空' })
  // code: string;
}
